//
//  AddSideDataTableViewCell.m
//  fitnessmanage
//
//  Created by wujian on 2018/1/1.
//  Copyright © 2018年 zongquankeji. All rights reserved.
//

#import "AddSideDataTableViewCell.h"

@implementation AddSideDataTableViewCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        UITextField *valueTF = [[UITextField alloc] init];
        valueTF.font = MidBigFont;
        valueTF.textColor = TFColor;
        valueTF.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:valueTF];
        self.valueTF = valueTF;
        
        UILabel *unitLabel = [[UILabel alloc] init];
        unitLabel.font = MidFont;
        unitLabel.textColor = CSColorFromRGB(0xb3b3b3);
        [self.contentView addSubview:unitLabel];
        self.unitLabel = unitLabel;
        
        [self setConstraints];
    }
    
    return self;
}

-(void)setConstraints{
    
    [self.valueTF mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.right.mas_equalTo(self.contentView).offset(-10);
        
        make.top.bottom.mas_equalTo(self.contentView);
        
        make.height.mas_equalTo(60);
        
        make.left.mas_equalTo(self.unitLabel.mas_right);
    }];
    
    
    [self.unitLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.left.mas_equalTo(self.contentView).offset(15);
        
        make.centerY.mas_equalTo(self.contentView);
        
        make.width.mas_equalTo(150);
    }];
}

- (void)drawRect:(CGRect)rect
{
    CGContextRef context =UIGraphicsGetCurrentContext();
    
    CGContextBeginPath(context);
    
    CGContextSetLineWidth(context,1.0);//线宽度
    
    CGContextSetStrokeColorWithColor(context,LineBackGroundColor.CGColor);
    
    CGContextMoveToPoint(context,10,rect.size.height);
    
    CGContextAddLineToPoint(context,SCREEN_WIDTH,rect.size.height);
    
    CGContextStrokePath(context);
}

@end
